package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.MobileSetmealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 移动端体检预约查询所有套餐数据
 *
 * @author dwj
 * @since 2023/4/27 11:05
 */
@RestController
@RequestMapping("/mobile/setmeal")
@Slf4j
public class MobileSetmealController {
    @Autowired
    private MobileSetmealService mobileSetmealService;
    /**
     * 体检预约查询所有套餐
     */
    @GetMapping("/getSetmeal")
    public Result getSetmeal(){
        log.info("前后端连通");
      List<Setmeal> list =  mobileSetmealService.getSetmeal();
      return new Result(true, MessageConst.QUERY_SETMEAL_SUCCESS,list);
    }
    /**
     * 体检预约功能-套餐详情
     */
    @GetMapping("findById")
    public Result fingById(Integer id){
        log.info("前后端连通");
       Setmeal setmeal = mobileSetmealService.findById(id);
        return new Result(true,MessageConst.QUERY_SETMEAL_SUCCESS,setmeal);
    }
}
